# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=ofono
pkgver=2.3
pkgrel=0
pkgdesc="Infrastructure for building mobile telephony (GSM/UMTS) applications"
url="https://01.org/ofono"
arch="all"
license="GPL-2.0-only"
depends="dbus mobile-broadband-provider-info"
makedepends="
	bluez-dev
	bsd-compat-headers
	dbus-dev
	ell-dev
	eudev-dev
	glib-dev
	linux-headers
	"
subpackages="
	$pkgname-dbg
	$pkgname-dev
	$pkgname-doc
	$pkgname-openrc
	$pkgname-scripts::noarch
	"
source="https://www.kernel.org/pub/linux/network/ofono/ofono-$pkgver.tar.xz
	skip-broken-test.patch
	$pkgname.initd
	$pkgname.confd
	ofono-wheel.conf
	"

build() {
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--sbindir=/usr/sbin \
		--enable-external-ell \
		--enable-test \
		--with-dbusconfdir=/usr/share
	make
}

check() {
	make -j1 check
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm644 plugins/ofono.rules "$pkgdir"/usr/lib/udev/rules.d/60-ofono.rules
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
	install -Dm755 "$srcdir"/ofono-wheel.conf -t "$pkgdir"/usr/share/dbus-1/system.d/
}

scripts() {
	pkgdesc="$pkgdesc (test scripts)"
	depends="python3 py3-dbus py3-gobject3"

	amove usr/lib/ofono/test
}

sha512sums="
0c53c2c441d28f89140192fe808769b3b27ef1ebf75e9ee9f9bfa53d0d102a47d11fcb364077ca88cdc598e8368924f477024b44a2adf795efe40b52ffe92dce  ofono-2.3.tar.xz
777ab2e13eebd1ccbe12a304310a83b262a5d934207c6a8d410e75aff380838eed1a52f3c2fe0d80c1e7db7faa9b55bf17e78a1e1acd8cfb95a3c6aef49c5b67  skip-broken-test.patch
f0edaf0ee1c18e266b88d6679b1668d56cc114ae21531e1f584e7a3e5f5eacb2a5f48a0bd1e2a17650b4c9d061130b6534094a1b55dbb19b473343d3f9392555  ofono.initd
0a894374b2573b893b6c89efaf3e6ef725f24064c425400ab65951849aee273daa99add6e5ac92e1e4c9c144c2e16def185a38d6b679804a9ed2afca599b22a0  ofono.confd
72cd0cd4bee1f885a990c84f7ed3ef27e0d9d2db37d9a486342204152cb02a67d5197e8014dfea59f1a95285c674695b3dc3cb2b53941781bcfc9b73d5580b1f  ofono-wheel.conf
"
